﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Active.Modules.Social;
using DotNetNuke.Modules.ActiveSocialMigrator.Data;
using System.Text;
using DotNetNuke.Security.Roles;
using DotNetNuke.Framework;
using DotNetNuke.Services.Localization;
using System.Data;

namespace DotNetNuke.Modules.ActiveSocialMigrator
{
    public partial class Journal : ActiveSocialMigratorModuleBase
    {
        override protected void OnInit(EventArgs e)
        {
            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
           ServicesFramework.Instance.RequestAjaxAntiForgerySupport();

           if (!Page.IsPostBack) {
               StringBuilder sb = new StringBuilder();
               var journalDB = new JournalDB();
               using (IDataReader dr = journalDB.Journal_Types(PortalId)) {
                   while (dr.Read()) {
                       sb.Append("<li>");
                       sb.Append("<input type=\"checkbox\" id=\"jt-" + dr["JournalTypeId"].ToString() + "\" checked=\"checked\" />");
                       sb.Append(Localization.GetString("[RESX:JF:" + dr["JournalType"].ToString().ToUpper() + "].Text", "~/DesktopModules/ActiveSocial/App_LocalResources/SharedResources.resx"));
                       sb.Append("</li>");
                   }
                   dr.Close();
               }
               litJournalTypes.Text = sb.ToString();           
               
           }
        }
    
        
       
    }
}